'''
test Result
'''

class CaseResult:

    def __init__(self, testContent):
        self.testContent = testContent

    def parserKeyword(self):
        itemList = self.testContent.split('：')[0].split('_')
        menu = itemList[0]
        market = itemList[1]
        deal = itemList[2]
        type_ = itemList[3]
        testFunc = itemList[4]
        testpointSuffix = self.testContent.split('：')[1]
        return menu, market, deal, type_, testFunc, testpointSuffix

    def excptedResult(self, dict):
        menu, market, deal, type_, testFunc, testpoint = self.parserKeyword()
        '''
        新三 ]卖出 {'isAvailable': '有效', 'testResult': '条件符合后触发'}
        '''
        if dict.get('isAvailable') == '有效':
            result1 = f'{menu}{type_}{deal}委托下达成功；'
        else:
            result1 = ''
        if  dict.get('testResult'):
            result2 = dict.get('testResult')
        else:
            result2 = ''
        return result1 + result2

if __name__ == '__main__':
    from Frames.testCaseParser import Parser
    Parser().sortedDict()
    for content,value in Parser().testContentOrderedDict.items():
        print(CaseResult(content).excptedResult(value))
